-- background: 2114 from stack: in -- bmap block id: 17904 -- flags: 0000 -- background id: 0 -- name: Weekly ----- HyperTalk script ----- on newStack extendWeekly end newStack on extendWeekly global it -- Make a year's worth of new cards. answer "Make another six months of new cards?" with "OK" or "Cancel" if it is "Cancel" then exit extendWeekly put 60*60*24 into OneDay --seconds in a day go to last card of this background put getStartDate() into start --what date to begin on if start is "Cancel" then exit extendWeekly repeat with cnt = 1 to (26+1) --weeks in a year put start into it --a copy convert it to dateItems put (item 1 of it) & space into field "Month" -- "1987 " put WeekNumber(start) into field "WeekNumber" convert it to long date put word 1 of item 2 of it after field "Month" -- "1987 June" Repeat with index = 1 to 7 put word index of ("Monday Tuesday Wednesday Thursday" && "Friday Weekend Weekend") into myDay put start into it convert it to dateItems if index = 7 then put return & (item 3 of it) after field myDay --day of month --Sunday is in same field as Sat, but on second line else put (item 3 of it) into field myDay --normal day end if add OneDay to start --get ready for the next day end repeat doMenu "New Card" --add a card for the next week end repeat doMenu "delete card" --get rid of extra card at end end extendWeekly function getStartDate -- end of stack or today, whichever is newer get field "Month" if it is empty then put the date into it else put (word 2 of it) & space before it --get month first delete word 3 of it put space & field "monday" & "," after word 1 of it end if put startOfWeek(it) into it --so we can compare put the date into thisWeek put startOfWeek(thisWeek) into thisWeek --both at week starts in seconds if thisWeek < 2587766400 then answer "Set the Control Panel to today's date" with "OK" return "Cancel" end if if it >= thisWeek then return it --calendar already beyond today convert it to short date convert thisWeek to short date answer "Start from which date?" with it or thisWeek or "Cancel" if it is "Cancel" then return it convert it to seconds return it end getStartDate function startOfWeek aDate -- the seconds for the start of this week put 60*60*24 into OneDay --seconds in a day put aDate into it convert it to long date repeat while item 1 of it <> "Monday" convert it to seconds subtract OneDay from it convert it to long date end repeat convert it to seconds return it end startOfWeek function weekNumber start put start into now convert now to dateItems put "Jan 1, " & (item 1 of now) into it put startOfWeek(it) into it --beginning of this year put 60*60*24*7 into OneWeek --seconds in a day put ((start-it)/OneWeek) +1 into it --weeks into this year return trunc(it) --an integer end weekNumber -- part 12 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=32 top=77 right=149 bottom=223 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 14 -- part name: -- part 14 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=32 top=166 right=238 bottom=223 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 14 -- part name: -- part 15 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=31 top=256 right=328 bottom=222 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 14 -- part name: -- part 45 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=284 top=77 right=149 bottom=475 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 14 -- part name: -- part 17 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=283 top=168 right=240 bottom=474 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 14 -- part name: -- part 18 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=289 top=270 right=329 bottom=474 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 14 -- part name: -- part 27 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=13 top=25 right=58 bottom=201 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 2 -- text size: 24 -- style flags: 0 -- line height: 32 -- part name: Month -- part 20 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=276 top=251 right=273 bottom=335 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 2 -- text size: 18 -- style flags: 0 -- line height: 24 -- part name: WeekNumber -- part 21 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=51 top=57 right=83 bottom=83 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 2 -- text size: 18 -- style flags: 0 -- line height: 24 -- part name: monday -- part 22 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=53 top=146 right=172 bottom=85 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 2 -- text size: 18 -- style flags: 0 -- line height: 24 -- part name: tuesday -- part 23 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=48 top=236 right=262 bottom=80 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 2 -- text size: 18 -- style flags: 0 -- line height: 24 -- part name: wednesday -- part 24 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=472 top=57 right=83 bottom=507 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 2 -- text size: 18 -- style flags: 0 -- line height: 24 -- part name: thursday -- part 25 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=471 top=147 right=173 bottom=507 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 2 -- text size: 18 -- style flags: 0 -- line height: 24 -- part name: friday -- part 26 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=471 top=237 right=284 bottom=510 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 2 -- text size: 18 -- style flags: 0 -- line height: 24 -- part name: weekend -- part 67 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=95 top=25 right=60 bottom=134 -- title width / last selected line: 0 -- icon id / first selected line: 4432 / 4432 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: To Do ----- HyperTalk script ----- on mouseUp visual effect zoom open go first card of background "To Do" end mouseUp -- part 68 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=133 top=25 right=60 bottom=172 -- title width / last selected line: 0 -- icon id / first selected line: 8961 / 8961 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: ----- HyperTalk script ----- on mouseUp Answer "You are already here." with "OK" end mouseUp -- part 72 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=171 top=25 right=60 bottom=210 -- title width / last selected line: 0 -- icon id / first selected line: 22855 / 22855 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Yearly ----- HyperTalk script ----- on mouseUp get field "Month" put space & word 1 of it after it delete word 1 of it put space & field "Monday" & "," after word 1 of it goSixMonthly it end mouseUp -- part 75 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=461 top=26 right=61 bottom=500 -- title width / last selected line: 0 -- icon id / first selected line: 14953 / 14953 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Home ----- HyperTalk script ----- on mouseUp visual effect dissolve go "home" end mouseUp -- part 76 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=275 top=28 right=56 bottom=312 -- title width / last selected line: 0 -- icon id / first selected line: 19381 / 19381 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Prev ----- HyperTalk script ----- on mouseUp go to previous card end mouseUp -- part 77 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=312 top=28 right=55 bottom=349 -- title width / last selected line: 0 -- icon id / first selected line: 22308 / 22308 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Next ----- HyperTalk script ----- on mouseUp go to next card end mouseUp